package com.juyu.miliao.api.dao.mysql;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.juyu.miliao.api.domain.UserPhoto;
import com.juyu.miliao.common.dataSource.tool.operate.Operate;

@Repository
public class UserPhotoDao {
	@Autowired
	private SqlSession sqlSession;
	
	@Operate("strategy('byUserId', #id)")
	public List<UserPhoto> getUserPhotoById(long id){
		return sqlSession.selectList("getUserPhotoById", id);
	}
	@Operate("strategy('byUserId', #id)")
	public int deleteUserPhotoById(long id){
		return sqlSession.delete("deleteUserPhotoById", id);
	}
	@Operate("strategy('byUserId', #entity.userId)")
	public int insertUserPhoto(@Param("entity")UserPhoto entity){
		return sqlSession.insert("insertUserPhoto", entity);
	}
	
}
